home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 26.zip
/
BS1 part 26
/
Newsflash issue 2 disk 1.adf
/
PROG
/
cmd_player.c.pp
/
cmd_player.c
Wrap
C/C++ Source or Header
|
1990-01-23
|
2KB
|
69 lines
/************************************************************************/
/************************************************************************/
#include <stdio.h>
#include <rexx/storage.h>
#include <rexx/errors.h>
char *portname="Multi_Player";
/***********************/
/* PROGRAMME PRINCIPAL */
/***********************/
main(argc,argv)
int argc;
char **argv;
{
if(argc>1){
if(send_msg(argv[1])!=0){
exit(-1);
}
}else{
printf("usage: cmd_player <cmd_name>\n");
printf("Cmd name can be: Play <module name>->load and play a song\n");
printf(" : Stop ->stop the song\n");
printf(" : Start ->restart a stopped song\n");
printf(" : Select <song num> ->select a song, only with TFMX\n");
printf(" : Quit ->stop the player\n");
}
exit(0);
}
send_msg(buf)
char *buf;
{
struct RexxMsg rx_message;
struct MsgPort *rexx_port = NULL;
struct MsgPort *reply_port = NULL;
int code_ret;
code_ret=0;
Forbid();
if( (rexx_port=FindPort (portname)) ==NULL){
printf("Multi player not found!\n");
Permit();
code_ret=-1;
}else if((reply_port=(struct MsgPort *)CreatePort ("Reply port", 0L))==NULL){
printf("Cannot create replay port!\n");
Permit();
code_ret=-1;
}else{
rx_message.rm_Args[0]=buf;
rx_message.rm_Args[1]=NULL;
rx_message.rm_Args[2]=NULL;
rx_message.rm_Action=RXCOMM;
rx_message.rm_Node.mn_ReplyPort=reply_port;
rx_message.rm_Node.mn_Node.ln_Type=NT_MESSAGE;
PutMsg(rexx_port,&rx_message);
Permit();
WaitPort(reply_port);
DeletePort(reply_port);
if(rx_message.rm_Result1!=RC_OK)code_ret=-1;
}
return(code_ret);
}